package top.xchch;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main {
	public static void main(String[] args) {
		
		ApplicationContext context = new ClassPathXmlApplicationContext("applicationcontext.xml");
		
		/*
		// HelloWorld helloWorld = (HelloWorld)context.getBean("helloWorld");
		HelloWorld helloWorld = context.getBean(HelloWorld.class);
		helloWorld.hello();
		*/
		
		Car car = (Car) context.getBean("car");
		System.out.println(car.toString());
		
		Car car2 = (Car) context.getBean("car2");
		System.out.println(car2.toString());
		
		Person person = (Person) context.getBean("person");
		System.out.println(person.toString());
		
		Person person2 = (Person) context.getBean("person2");
		System.out.println(person2.toString());
		
		Person person3 = (Person) context.getBean("person3");
		System.out.println(person3.toString());
		
		DataSource dataSource = (DataSource) context.getBean("dataSource");
		System.out.println(dataSource.toString());
	} 
}
